package com.etbsms.util;

public class Utils {
	
	public static String transClazz2Code(String clazz){
		if(clazz == null)
			return "";
		
		int value = 100000;
		if(clazz.indexOf('E') != -1)
			value += 1;
		if(clazz.indexOf('D') != -1)
			value += 10;
		if(clazz.indexOf('C') != -1)
			value += 100;
		if(clazz.indexOf('B') != -1)
			value += 1000;
		if(clazz.indexOf('A') != -1)
			value += 10000;		
		return String.valueOf(value).substring(1);
	}
	
	public static String transCode2Clazz(String code){
		if(code == null)
			return "";	
		String clazz = "";		
		if(code.substring(0,1).equals("1"))
			clazz += "A,";
		if(code.substring(1,2).equals("1"))
			clazz += "B,";
		if(code.substring(2,3).equals("1"))
			clazz += "C,";
		if(code.substring(3,4).equals("1"))
			clazz += "D,";		
		if(code.substring(4,5).equals("1"))
			clazz += "E,";
		return clazz.substring(0,clazz.length()-1);
	}
}
